public class Dispatcher {

//	public Object type(String s) {
//		java.util.StringTokenizer objectString = new java.util.StringTokenizer(
//				s, ";");
//		String className = objectString.nextToken();
//		
//		if (className.equals("geometry.Point")) {
//			String temp = "";
//			while(objectString.hasMoreTokens()){
//				temp+=objectString.nextToken()+";";
//			}
//			return Point.deserialize(temp);
//		}
//		
//		if(className.equals("geometry.ColorPoint"))
//		{	
//			String temp = "";
//			while(objectString.hasMoreTokens()){
//				temp+=objectString.nextToken()+";";
//			}
//			return ColorPoint.deserialize(temp);
//		}
//		
//		if (className.equals("geometry.Segment")) {
//			return Segment.deserialize(s);
//		}		
//		
//		return null;
//	}
	
	public Object type(String s) {
		java.util.StringTokenizer objectString = new java.util.StringTokenizer(s, ";");
		String className = objectString.nextToken();
		if(className.equals("geometry.Point")) {
//			String temp = "";
//			while(objectString.hasMoreTokens()) {
//				temp+=objectString.nextToken()+";";
//			}
			return Point.deserialize(s);
		}
		if(className.equals("geometry.ColorPoint")) {
//			String temp = "";
//			while(objectString.hasMoreTokens()) {
//				temp+=objectString.nextToken()+";";
//			}
			return ColorPoint.deserialize(s);
		}
		if(className.equals("geometry.Segment")) {
//			String temp = "";
//			while(objectString.hasMoreTokens()) {
//				temp+=objectString.nextToken()+";";
//			}
			return Segment.deserialize(s);
		}
		return null;
	}
}
